package com.jwdf.uda.http.action;

import android.content.Context;
import android.text.TextUtils;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;
import com.jwdf.uda.utils.ConfigUtils;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/13 18:15
 * 邮箱：648859026@qq.com
 */
public class FollowListAction extends AHttpService<PbBean.PbResUserGetFollowList> {

    /**
     * 获取关注列表
     *
     * @param context
     * @param offset
     * @return
     */
    public static FollowListAction newInstance(Context context, int offset) {
        return new FollowListAction(context, offset);
    }

    public static FollowListAction newInstance(Context context, int offset, String userId) {
        return new FollowListAction(context, offset, userId);
    }

    private int offset;
    private String userId;

    private FollowListAction(Context context, int offset) {
        super(context);
        this.offset = offset;
    }

    private FollowListAction(Context context, int offset, String userId) {
        super(context);
        this.offset = offset;
        this.userId = userId;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqUserGetFollowList.Builder builder = PbBean.PbReqUserGetFollowList.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setOffset(offset);
        builder.setUserId(!TextUtils.isEmpty(userId) ? userId : ConfigUtils.getUserId(context));

        return apiService.getFollowList(builder.build());
    }
}
